package frame1;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder;

public class Demo3 extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Demo3 frame = new Demo3();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Demo3() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		
		JPanel l = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 3));
		l.add(new JButton("btn1"));
		l.add(new JButton("btn2"));
		l.add(new JButton("btn3"));
		l.add(new JButton("btn4"));
		l.add(new JButton("btn5"));
		
		JPanel r = new JPanel(new GridLayout(3, 3, 3, 3));
		for(int i = 0; i < 9; i++){
			JButton btn = new JButton("btn" + i);
			r.add(btn);
		}
		
		JSplitPane lfsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, l, r);
		lfsplit.setDividerSize(20);//设置分割线大小
		lfsplit.setDividerLocation(100);
		
		contentPane.add(lfsplit);
		
		setContentPane(contentPane);
	}

}
